package com.example.client;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableEurekaClient
@RestController
@RefreshScope
public class EurekaClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaClientApplication.class, args);
    }

    /*
    * 一启动就会报找不到value。（能从ConfigServer能访问到git的配置文件）
    *       ——没有依赖 SpringCloudConfig！！！
    * */

//        @Value("${server.port}")
//    @Value("${spring.application.name}")
    @Value("${hello}")
    String hello;

    @RequestMapping(value = "/hello")
    public String hello() {
        return "hello content:"+hello;
    }



    /*
    1.返回json，请求方用json接收
    2.直接返回对象呢？也没有问题，嵌套对象也没有问题
     */
    @RequestMapping(value = "/feignHello")
    public Person feignHello() {

        Person person = new Person("curry", "12", new Leg("11", "22"));

        return person ;
    }

}